//
//  DefultView.swift
//  letuofu
//
//  Created by WH-JS on 2020/1/10.
//  Copyright © 2020 WH-JS. All rights reserved.
//

import UIKit

class DefultView: UIView {
    var image : UIImage?
    var title : String = ""
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    
    static func initview(image: UIImage?,title: String) -> DefultView {
        let view = DefultView()
        view.image = image
        view.title = title
        return view
    }
    
    override func draw(_ rect: CGRect) {
        let imageView = UIImageView(image: image)
        drawView(view: imageView) { (make) in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(self.snp.centerY).offset(-10)
        }
        
        drawLabel(text: title, fontSize: 18, textColor: .x333333) { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(imageView.snp.bottom).offset(10)
        }
    }
}
